package structure.facade;

/**
 * @author lzp
 * @Date:2023/2/27
 * @description: 外观模式，中介，整合完整的公司注册、开户、纳税流程
 */
public class Facade {

	private static final AdminOfIndustry adminOfIndustry = new AdminOfIndustry();
	private static final Bank bank = new Bank();
	private static final Taxation taxation = new Taxation();

	public Company openCompany(String name) {
		// 注册公司
		Company c = adminOfIndustry.register(name);
		// 银行开户
		String bankAccount = bank.openAccount(c.getCompanyId());
		c.setBankAccount(bankAccount);
		// 纳税
		String taxCode = taxation.applyTaxCode(c.getCompanyId());
		c.setTaxCode(taxCode);
		return c;
	}

}
